home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / security / KeyPair.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  1.8 KB  |  70 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)KeyPair.java    1.8 98/06/29
  3.  *
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security;
  16.  
  17. import java.util.*;
  18.  
  19. /**
  20.  * This class is a simple holder for a key pair (a public key and a
  21.  * private key). It does not enforce any security, and, when initialized,
  22.  * should be treated like a PrivateKey.
  23.  *
  24.  * @see PublicKey
  25.  * @see PrivateKey
  26.  *
  27.  * @version 1.8 99/03/26
  28.  * @author Benjamin Renaud
  29.  */
  30.  
  31. public final class KeyPair implements java.io.Serializable {
  32.  
  33.     private PrivateKey privateKey;
  34.     private PublicKey publicKey;
  35.  
  36.     /**
  37.      * Constructs a key pair from the given public key and private key.
  38.      *
  39.      * <p>Note that this constructor only stores references to the public
  40.      * and private key components in the generated key pair. This is safe,
  41.      * because <code>Key</code> objects are immutable.
  42.      *
  43.      * @param publicKey the public key.
  44.      *
  45.      * @param privateKey the private key.
  46.      */
  47.     public KeyPair(PublicKey publicKey, PrivateKey privateKey) {
  48.     this.publicKey = publicKey;
  49.     this.privateKey = privateKey;
  50.     }
  51.  
  52.     /**
  53.      * Returns a reference to the public key component of this key pair.
  54.      *
  55.      * @return a reference to the public key.
  56.      */
  57.     public PublicKey getPublic() {
  58.     return publicKey;
  59.     }
  60.  
  61.      /**
  62.      * Returns a reference to the private key component of this key pair.
  63.      *
  64.      * @return a reference to the private key.
  65.      */
  66.    public PrivateKey getPrivate() {
  67.     return privateKey;
  68.     }
  69. }
  70.